package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.entity.NursingPlan;
import com.zzyl.mapper.NursingPlanMapper;
import com.zzyl.service.NursingPlanService;
import com.zzyl.vo.NursingPlanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description NursingPlanServiceImpl
 * @Author shuaijie LI
 * @Date 2024-08-27
 */
@Service
public class NursingPlanServiceImpl implements NursingPlanService {
    @Autowired
    private NursingPlanMapper nursingPlanMapper;

    //分页查询
    @Override
    public PageResponse<NursingPlanVo> page(String name, Integer pageNum, Integer pageSize, Integer status) {
        PageHelper.startPage(pageNum,pageSize);
        Page<NursingPlanVo> page = nursingPlanMapper.page(name, pageNum, pageSize, status);
        PageResponse<NursingPlanVo> pageResponse = new PageResponse<>();
        pageResponse.setRecords(page.getResult());
        pageResponse.setTotal(page.getTotal());
        return pageResponse;
    }

    @Override
    public List<NursingPlan> getAll() {
        List<NursingPlan> nursingPlanService = nursingPlanMapper.getAll();
        return nursingPlanService;
    }
}
